/*
 * Font.h
 *
 *  Created on: Jul 18, 2009
 *      Author: kurt
 */

#ifndef FONT_H_
#define FONT_H_

#include "Object.h"
#include "Color.h"
#include <intraFont.h>
#include <string>
#include <cstdarg>

namespace objdraw 
{

class Font: public objdraw::Object 
{
	protected:
		virtual ~Font();
		Font(const Font & f);
		
		intraFont * font;
		
		static bool intraFontInited;
		
	public:
		static int initIntraFont();
		static void shutdownIntraFont();
		static inline bool intraFontWasInit() { return intraFontInited; }
		
		virtual inline void Delete(){ delete this; }
		Font();
		Font(std::string file, unsigned int opts = 0);
		
		void activate();
		void setStyle(float size, Color color, Color shadowColor, unsigned int options);
		void setEncoding(unsigned int options);
		void setAlternateFont(Font * f);
		
		bool fontIsLoaded();
		intraFont * getFont();
		
		float printUCS2        (float x, float y, const unsigned short *text);
		float printUCS2Ex      (float x, float y, const unsigned short *text, int length);
		float printColumnUCS2  (float x, float y, float width, const unsigned short *text);
		float printColumnUCS2Ex(float x, float y, float width, const unsigned short *text, int length);
		
		float print        (float x, float y, const char *text);
		float printEx      (float x, float y, const char *text, int length);
		float printColumn  (float x, float y, float width, const char *text);
		float printColumnEx(float x, float y, float width, const char *text, int length);
		
		float printf        (float x, float y, const char *text, ...);
		
		float measureText  (const char *text);
		float measureTextEx(const char *text, int length);
		
		float measureTextUCS2  (const unsigned short *text); 
		float measureTextUCS2Ex(const unsigned short *text, int length); 
	
	friend class Text;
};

}

#endif /* FONT_H_ */
